import nci60.administration.Params
import nci60.data.protein.SourceOrganism

//sets the Services in the Upload class, to make them available
def helperService = ctx.getBean("helperService")


println 'changing the saved parameters'
def oldParams = helperService.getParameters()

Params.executeUpdate('delete from Params where id>0')

def newParams = [celllinecolors:oldParams.colors.cellline,
                 chromosomes:[:],
                 download:[:]]
             
def organism = SourceOrganism.findByName('Human')             
def bla = [rangeWidth:oldParams.chromosomes.rangeWidth,
           order:oldParams.chromosomes.human.order]
newParams.chromosomes.put('organism'+organism.id, bla)
newParams.download.put('proteins',oldParams.download.suppTables.proteins)
newParams.download.put('peptides',oldParams.download.suppTables.peptides)
newParams.download.put('maxQuant',oldParams.download.maxQuant)
newParams.download.put('rawFiles',oldParams.download.rawFiles)

helperService.setParameters(newParams)

println 'updating the cell lines, which should not be used in a comparative expression analysis'
['P001388', 'P003204'].each(){pNumber
    def cl = Experiment.findByPNumber(pNumber)
    cl.excluded = true
    if (!cl.save(flush:true)) {
        cl.errors.each {println it}
    }
}